Skip to main content

All Questions

2votes
1answer
355views

How to extract data more Efficient in an array?

I have a directory with some text files that have data like below; I read them via a loop and put each line in an array! I don't know the correct way and if you know any better way, let me know. ...
amkyp's user avatar
1vote
1answer
837views

How to give multidimensional array a value for each 'cells'

I'm not a programmer at all, but I need to write a script to cut a file and produce a multidimensional array from this file. I'm a chemist, so my array should be something like: [pe][pH][element][...
Nicolas Schmitt's user avatar
1vote
1answer
731views

How to split Bash array into arguments

I wrote a bash script for listing python processes, ram usage and PID and status in human readable form with colored lines. But I have some trouble with working time of the script. Because of the ...
Sencer H.'s user avatar
-1votes
1answer
775views

How to write the bash script dynamic to print row and columns data and update the same data in the same file? [closed]

abc_hosts,pwd_host_id,pwd_host_id,hostname,ddd_status,dddd_status, start_hosts,,,,,,,,,,,,,,,,,,, ,1,o1,fhffhfh,1,1,fff,fdfd,172.33.33.33,172.30.30.12,172.30.30.11,oreere.dff,43,443343,1111,43435,...
Sangram's user avatar
5votes
4answers
616views

Is there an easy way to do the equivalent of `sed ...` replacing the same line with multiple values?

I have a file where I want to replace some variables with data from a shell script. -A INPUT -i lo -s @LOCAL_IP@ -j ACCEPT Here I want to replace @LOCAL_IP@ with an IP address, I use the following: ....
Alexis Wilke's user avatar
2votes
1answer
345views

How to sum numbers inside many 2D arrays

I need to sum numbers located in a file like this one: column1 column2 column3 row1 a(1,1) a(1,2) a(1,3) row2 a(2,1) a(2,2) a(2,3) row3 a(3,1) a(3,2) a(3,3) row4 a(4,1) a(4,2) ...
alloppp's user avatar
2votes
1answer
378views

Bash script to summarize " last -a "

I would like to make a shell script such that it runs the " last -a " command and summarizes it's data in the form : userID : number of login sessions Host or ip1 - number of ...
DynamicQ's user avatar
2votes
4answers
1kviews

Find the complement set of an array?

Following from this question, where I wish to extract 10 random lines from a file, I now wish to also have the remaining 90 lines as a separate file. Since the document has 100 lines, indexing from 1 ...
Sibbs Gambling's user avatar

close